import React, { forwardRef, useImperativeHandle, useState } from 'react'

function Chlild (props, ref) {
  const [count, setCount] = useState(100)
  //子组件暴露的内容
  useImperativeHandle(ref, () => {
    return { setCount }
  })

  return (
    <div>
      Chlild
      <p>count is {count}</p>
    </div>
  )
}
export default forwardRef(Chlild)
